<?php
use \GatewayWorker\Lib\Gateway;
class cmdbase
{
	/** @var ?string */
    public $client_id;

    protected function getCurClientId(){
    	return $this->client_id;
    }

    protected function getCurGroupId(){
    	$group_id = ClientMgr::getCurGroupId();
    	return $group_id;
    }

    protected function getCurUid(){
        $client_id = $this->getCurClientId();
        $user_id = Gateway::getUidByClientId($client_id);
        return $user_id;
    }

    protected  function sendToGroup($msg_name, $msg_body){
        $group_id = $this->getCurGroupId();
        if(!isset($group_id))
            return false;
        Events::sendToGroup($group_id, $msg_name, $msg_body);
        return true;
    }

    protected  function sendToCurrentClient($msg_name, $msg_body){
        Events::sendToCurrentClient($msg_name, $msg_body);
    }
}